package com.abl.controller.position;

import com.abl.common.security.annotation.ResC;
import com.abl.common.security.annotation.ResM;
import com.abl.domain.model.Param;
import com.abl.domain.model.SRS;
import com.abl.controller.BaseController;
import com.abl.service.position.PositionMapService;
import com.alibaba.fastjson2.JSONObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@ResC("商场定位系统（地图管理）")
@Tag(name = "商场定位系统（地图管理）")
@RestController
@RequestMapping("/position/area/map")
public class PositionMapController extends BaseController {

    @Autowired
    private PositionMapService positionMarketService;

    /**
     * 获取地图信息
     *
     * @apiNote 获取地图信息
     */
    @ResM("获取地图信息")
    @PostMapping(value = {"/list"})
    public SRS<Object> list(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(positionMarketService.list(param));
    }

    @ResM("新增区域")
    @PostMapping({"/add"})
    public SRS<Object> addArea(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(positionMarketService.add(param));
    }

    @ResM("新增区域")
    @PostMapping({"/edit"})
    public SRS<Object> editArea(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(positionMarketService.edit(param));
    }

    @ResM("删除区域")
    @PostMapping({"/del"})
    public SRS<Object> delArea(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(positionMarketService.del(param));
    }

    @ResM("匹配输入内容，按区域名称搜索")
    @PostMapping({"/searchInput"})
    public SRS<Object> searchInput(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(positionMarketService.searchInput(param));
    }

}
